<template>
	<div>
		<div class="u-pl-15 u-pr-15">
			<u-form :model="form" ref="uForm">
				<u-form-item label="A级测评报酬(元)" label-width="300rpx">
					<div class="u-text">{{demand.levelAReward}}</div>
				</u-form-item>
				
				<u-form-item label="A级名额(人)" label-width="300rpx">
					<div class="u-text">{{demand.levelAQuota}}</div>
				</u-form-item>
				
				<u-form-item label="A级评级标准" label-position="top">
					<div class="u-richtext">{{demand.levelACriterion}}</div>
				</u-form-item>
				
				<u-form-item label="B级测评报酬(元)" label-width="300rpx">
					<div class="u-text">{{demand.levelBReward}}</div>
				</u-form-item>
				
				<u-form-item label="B级名额(人)" label-width="300rpx">
					<div class="u-text">{{demand.levelBQuota}}</div>
				</u-form-item>
				
				<u-form-item label="B级评级标准" label-position="top">
					<div class="u-richtext">{{demand.levelBCriterion}}</div>
				</u-form-item>
				
				<u-form-item label="C级测评报酬(元)" label-width="300rpx">
					<div class="u-text">{{demand.levelCReward}}</div>
				</u-form-item>
				
				<u-form-item label="C级名额(人)" label-width="300rpx">
					<div class="u-text">{{demand.levelCQuota}}</div>
				</u-form-item>
				
				<u-form-item label="C级评级标准" label-position="top">
					<div class="u-richtext">{{demand.levelCCriterion}}</div>
				</u-form-item>
				
				<u-form-item label="测评总费用(元)" label-width="300rpx">
					<div class="u-text">{{demand.purchasePrice}}</div>
				</u-form-item>
				
				<u-form-item label="测评总人数(人)" label-width="300rpx">
					<div class="u-text">{{demand.joinQuota}}</div>
				</u-form-item>
			</u-form>
		</div>
		
		<div class="u-page" style="background:#fff;">
			<!-- 测评要求设置 -->
			<p class="v-sperate"></p>
			<section class="j-block bg-white">
				<div id="qualityreport"></div>
				<div class="n-goodsdetailbar">
					<p class="txt">测评要求设置</p>
					<img class="v-img"
						src="https://dev.openea.net/linkey/bpm/appfile/Review/8cdd326d-c127-4f53-8183-85fac74233de.jpg">
				</div>
				<div class="u-pb-40" style="margin: 10px;">
					<u-parse :html="this.escape2Html(demand.remarks)"></u-parse>
				</div>
			</section>

			<!-- 验收要求设置 -->
			<p class="v-sperate"></p>
			<section class="j-block bg-white">
				<div id="qualityreport"></div>
				<div class="n-goodsdetailbar">
					<p class="txt">验收要求设置</p>
					<img class="v-img"
						src="https://dev.openea.net/linkey/bpm/appfile/Review/8cdd326d-c127-4f53-8183-85fac74233de.jpg">
				</div>
				<div class="u-pb-40" style="margin: 10px;">
					<u-parse :html="this.escape2Html(demand.requirements)"></u-parse>
				</div>
			</section>
		</div>
		
		
		<div style="height: 180rpx;"></div>
		<!-- 按钮 -->
		<div style="position: fixed;bottom: 0rpx;background-color: #f5f7f7e6;width: 100%;">
			<div class="u-pt-20 u-pb-20" style="width: 90%;margin: 0 auto;">
				<u-button :custom-style="customStyle" shape="square" @click="confirm">
					确定
				</u-button>
			</div>
		</div>
		
	</div>
</template>

<script>
	export default {
		data() {
			return {
				demand: {},
				customStyle: {
					background: '#e55e97 !important',
					color: '#fff !important',
					border: 'none !important'
				}
			}
		},

		onLoad(options) {
			// 未登录跳转到登录页面
			var loginRes = this.checkLogin()
			if (!loginRes) {
				return false;
			}
			
			let demand_info = decodeURIComponent(options.demand);
			this.demand = JSON.parse(demand_info);
			
			/* if (this.isNotNull(options.DemandUnid)) {
				this.getDemandDetails(options.DemandUnid);
			} else {
				this.showMSG('error', '数据有误')
				setTimeout(() => {
					this.goBack()
				}, 1500)
			} */
		},

		methods: {

			/**
			 * 获取测评需求详情
			 */
			async getDemandDetails(DemandUnid) {
				/* const userInfo = uni.getStorageSync('userInfo')
				let result = await this.$u.api.unifyRequest({
					userId: userInfo.userId,
					nickName: userInfo.nickName,
					appid: 'ProductPromote',
					wf_num: 'R_ProductPromote_B014',
					DemandUnid: DemandUnid,
					loading: true // 默认发起请求会有一个全局的Loading，设置false可去掉
				});
				if (result.code == 200) {
					this.demand = result.data;
				} */
				
				const userInfo = uni.getStorageSync('userInfo');
				let result = await this.$u.api.unifyMiniRestGet({
					systemid: "meily",
					url: "/evaluation/list",
					id: DemandUnid,
					loading: false
				});
				if (result.code == 200) {
					this.demand = result.data;
				}
			},
			
			/**
			 * 确定
			 */
			async confirm() {
				console.log("确定....")
				
				uni.$emit("saveDemand", this.demand);
				wx.navigateBack({
					delta: 2
				});
			}

		}
	}
</script>

<style scoped>
	.aui-scrollView {
		width: 100%;
		height: 100%;
		-webkit-box-flex: 1;
		-webkit-flex: 1;
		-ms-flex: 1;
		flex: 1;
		overflow-y: auto;
		overflow-x: hidden;
		-webkit-overflow-scrolling: touch;
		position: relative;
		margin-top: 0;
	}

	.aui-navBar {
		height: 44px;
		position: relative;
		display: -webkit-box;
		display: -webkit-flex;
		display: -ms-flexbox;
		display: flex;
		z-index: 1002;
		background: #f7f7f7;
	}

	.b-line {
		position: relative;
	}

	.b-line:after {
		content: '';
		position: absolute;
		z-index: 2;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 1px;
		border-bottom: 1px solid #e2e2e2;
		-webkit-transform: scaleY(0.5);
		transform: scaleY(0.5);
		-webkit-transform-origin: 0 100%;
		transform-origin: 0 100%;
	}

	.aui-navBar-item {
		height: 44px;
		min-width: 25%;
		-webkit-box-flex: 0;
		-webkit-flex: 0 0 25%;
		-ms-flex: 0 0 25%;
		flex: 0 0 25%;
		padding: 0 0.9rem;
		display: -webkit-box;
		display: -webkit-flex;
		display: -ms-flexbox;
		display: flex;
		-webkit-box-align: center;
		-webkit-align-items: center;
		-ms-flex-align: center;
		align-items: center;
		font-size: 0.7rem;
		white-space: nowrap;
		overflow: hidden;
		color: #353535;
		position: relative;
	}

	.aui-navBar-item:first-child {
		-webkit-box-ordinal-group: 2;
		-webkit-order: 1;
		-ms-flex-order: 1;
		order: 1;
		margin-right: -25%;
		font-size: 0.9rem;
		font-weight: bold;
	}

	.aui-navBar-item:last-child {
		-webkit-box-ordinal-group: 4;
		-webkit-order: 3;
		-ms-flex-order: 3;
		order: 3;
		-webkit-box-pack: end;
		-webkit-justify-content: flex-end;
		-ms-flex-pack: end;
		justify-content: flex-end;
	}

	.aui-center {
		-webkit-box-ordinal-group: 3;
		-webkit-order: 2;
		-ms-flex-order: 2;
		order: 2;
		display: -webkit-box;
		display: -webkit-flex;
		display: -ms-flexbox;
		display: flex;
		-webkit-box-pack: center;
		-webkit-justify-content: center;
		-ms-flex-pack: center;
		justify-content: center;
		-webkit-box-align: center;
		-webkit-align-items: center;
		-ms-flex-align: center;
		align-items: center;
		height: 44px;
		width: 50%;
		margin-left: 25%;
	}

	.aui-center-title {
		text-align: center;
		width: 100%;
		white-space: nowrap;
		overflow: hidden;
		display: block;
		text-overflow: ellipsis;
		font-size: 0.95rem;
		color: #333;
	}

	.icon {
		width: 20px;
		height: 20px;
		display: block;
		border: none;
		float: left;
		background-size: 20px;
		background-repeat: no-repeat;
	}

	.aui-flex {
		display: -webkit-box;
		display: -webkit-flex;
		display: flex;
		-webkit-box-align: center;
		-webkit-align-items: center;
		align-items: center;
		padding: 15px;
		position: relative;
	}

	.aui-flex-box {
		-webkit-box-flex: 1;
		-webkit-flex: 1;
		flex: 1;
		min-width: 0;
		font-size: 14px;
		color: #333;
	}

	.aui-flex-triangle {
		position: relative;
		font-size: 14px;
		padding-right: 15px;
	}

	.aui-flex-triangle:before {
		content: '';
		width: 0;
		height: 0;
		border-width: 5px 0px 5px 8px;
		border-style: solid;
		border-color: transparent transparent transparent #7b7b7b;
		position: absolute;
		top: 6px;
		right: 0;
		border-radius: 1;
	}

	.aui-choice-white {
		background: #fff;
	}

	.aui-order-box {
		padding: 10px 10px 10px 0px;
	}

	.aui-flex-goods {
		margin-right: .8em;
		width: 80px;
		height: 80px;
		line-height: 80px;
		text-align: center;
	}

	.aui-flex-goods img {
		width: 100%;
		max-height: 100%;
		vertical-align: top;
	}

	.aui-flex-default {
		background: #f3f1f1;
	}

	.aui-flex-default h2 {
		font-size: 14px;
		width: auto;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		word-wrap: normal;
		word-wrap: break-word;
		word-break: break-all;
		padding-bottom: 5px;
	}

	.aui-flex-default p {
		color: #999999;
		font-size: 12px;
	}

	.aui-flex-clear {
		padding: 0;
		margin-top: 20rpx;
	}

	.aui-flex-clear .aui-flex-box {
		color: #f21956;
		font-weight: bold;
	}

	.aui-mar15 {
		margin-bottom: 15px;
	}

	.aui-flex-triangle-clear:before {
		border-color: #fff;
	}

	.aui-flex-box h2 {
		font-size: 16px;
		padding-bottom: 5px;
	}

	.aui-flex-box h3 {
		font-size: 14px;
		padding-bottom: 5px;
	}

	.aui-flex-box p {
		font-size: 12px;
		color: #999;
		line-height: 1.2;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 1;
	}

	.aui-bar-footer {
		line-height: 52px;
		height: 52px;
		background: #fff;
		box-shadow: 0 -2px 10px #ddd;
		position: fixed;
		z-index: 999;
		bottom: 0;
		left: 0;
		width: 100%;
	}

	.aui-btn-button {
		background: #f21956;
		padding: 0 25px;
		color: #fff;
		font-size: 14px;
	}

	.aui-bar-footer .aui-flex {
		padding: 0;
	}

	.aui-bar-footer .aui-flex-box {
		padding-left: 15px;
	}

	.aui-bar-footer .aui-flex-box span {
		font-style: normal;
		color: #f21956;
	}
	
	.v-sperate {
		height: 10px;
		background: #f1f1f1;
	}
	
	.n-goodsdetailbar {
		position: relative;
		height: 44px;
	}
	
	.n-goodsdetailbar .txt {
		position: absolute;
		top: 0;
		left: 0px;
		z-index: 9;
		width: 100%;
		height: 44px;
		line-height: 44px;
		text-align: center;
		font-size: 12px;
		/* font-weight: bold; */
		color: #f21956;
	}
	
	.n-goodsdetailbar .v-img {
		display: block;
		position: absolute;
		top: 0px;
		left: 0px;
		width: 100%;
		height: 90rpx;
	}
	
	img {
		vertical-align: middle;
		border: 0;
	}
	
	.u-text{
		text-align: end;
		padding-right: 40rpx;
		/* font-weight: bold; */
	}
	
	.u-richtext{
		font-size: small;
		padding-left: 20rpx;
		/* font-weight: bold; */
	}
	
</style>
